a = input().replace(' ', '')
for b in a:
    if b !='(' and b !=')' and b != '{' and b !=')' and b !='<' and b!='>'and b !='[' and b !=']':
        a=a.replace(b, '')
while '{}' in a or '[]' in a or '()' in a or '<>' in a:
    a = a.replace('[]', '')
    a = a.replace('{}', '')
    a = a.replace('()', '')
    a = a.replace('<>', '')
if len(a) > 0:
    print('False')
else:
    print('True')
